﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace OnlineBookReader
{
    public class DetailInfo
    {
        public DetailInfo( string uri,Type controlType)
        {
            Uri = uri;
            ControlType = controlType;
        }
        public string Uri { get; private set; }

        /// <summary>
        /// Gets the sample type.
        /// </summary>
        public Type ControlType { get; private set; }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public FrameworkElement GetSample()
        {
            // Create the sample from the type if we have one

            FrameworkElement sample = string.IsNullOrEmpty(Uri) ? (FrameworkElement)Activator.CreateInstance(this.ControlType) : (FrameworkElement)Activator.CreateInstance(this.ControlType, Uri);
            sample.VerticalAlignment = VerticalAlignment.Top;
            sample.HorizontalAlignment = HorizontalAlignment.Left;
            sample.Margin = new Thickness(10, 0, 0, 0);
            return sample;
        }
    }
}
